package com.dream.inspect.modules.sys.common;

import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;

import com.dream.inspect.modules.app.constants.AttrConstants;

public class RetryLimitHashedCredentialsMatcher extends HashedCredentialsMatcher {

    @Override
    public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {

        MyUsernamePasswordToken myNoPasswordToken=(MyUsernamePasswordToken) token;
        //如果是免密，就不需要核对密码了
        if(myNoPasswordToken.getLoginType().equals(AttrConstants.PSTORE)) {
            return true;
        }
        return super.doCredentialsMatch(token, info);
    }
}

